package me.zhengjie.modules.serviceprovider.service;

import me.zhengjie.modules.serviceprovider.domain.TServiceproviderInfo;
import me.zhengjie.modules.serviceprovider.service.dto.TServiceproviderInfoDTO;
import me.zhengjie.modules.serviceprovider.service.dto.TServiceproviderInfoQueryCriteria;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.query.Param;

import java.util.ArrayList;
import java.util.List;

/**
* @author xuyukun
* @date 2019-07-20
*/
// @CacheConfig(cacheNames = "tServiceproviderInfo")
public interface TServiceproviderInfoService {

    /**
    * queryAll 分页
    * @param criteria
    * @param pageable
    * @return
    */
   // @Cacheable(keyGenerator = "keyGenerator")
    Object queryAll(TServiceproviderInfoQueryCriteria criteria, Pageable pageable);
    
    Object queryProviderEvaluates(TServiceproviderInfoQueryCriteria criteria, Pageable pageable);

    /**
    * queryAll 不分页
    * @param criteria
    * @return
    */
    //@Cacheable(keyGenerator = "keyGenerator")
    public Object queryAll(TServiceproviderInfoQueryCriteria criteria);

    /**
     * findById
     * @param id
     * @return
     */
    //@Cacheable(key = "#p0")
    TServiceproviderInfoDTO findById(Long id);

    /**
     * create
     * @param resources
     * @return
     */
    // @CacheEvict(allEntries = true)
    TServiceproviderInfoDTO create(TServiceproviderInfo resources);

    /**
     * update
     * @param resources
     */
    // @CacheEvict(allEntries = true)
    void update(TServiceproviderInfo resources);

    /**
     * delete
     * @param id
     */
    // @CacheEvict(allEntries = true)
    void delete(Long id);

    XSSFWorkbook exportEvaluate(TServiceproviderInfoQueryCriteria criteria);

    /**
     * 查询符合条件的供应商,取id/名字
     * @param major
     * @param level
     * @param country
     * @param province
     * @param city
     * @param county
     * @return
     */
    public List<Object[]> queryServiceproviderInfo(String major,
                                                   ArrayList<String> level,
                                                   String country,
                                                   String province,
                                                   String city,
                                                   String county);


    /**
     * 审核
     * @param id
     * @param state
     * @param reason
     */
    void verify(Long id, Integer state, String reason,Long seproId);


    /**
     * 重置邀请码
     * @param id
     * @param inviteCode
     */
    String resetInviteCode(Long id, String inviteCode);

    TServiceproviderInfoDTO findByInviteCode(String inviteCode);
    TServiceproviderInfoDTO findBySeproCode(String inviteCode);

}